<extend name="Base/ucmobile_base" />
<!-- addons模块css -->
<block name="style">
  <link rel="stylesheet" href="{:ADDON_PUBLIC_PATH}/css/app.css">
</block>
<block name="body">

    <!-- Header -->
    <header data-am-widget="header" class="am-header am-header-default">
      <h1 class="am-header-title">
        <a href="#title-link">{$data.title}</a>
      </h1>
    </header>


    <!-- Slider -->
    <div data-am-widget="slider" class="am-slider am-slider-a1" data-am-slider='{&quot;directionNav&quot;:false}'>
      <ul class="am-slides">
        <li>
          <img src="<notempty name="data.back_ground">{$data.back_ground|get_cover_url}</notempty>">
        </li>
      </ul>
    </div>
    <div class="am-g">
      <div class="am-u-sm-4"></div>
      <div class="am-u-sm-4 am-u-sm-centered">
        <notempty name="error">
          <h3 class="get_error">
            {$error}
          </h3>
          <else />
          <button class="am-btn am-btn-secondary" data-am-modal="{target: '#my-actions'}">关注公众号获取红包</button>
        </notempty>
      </div>
      <div class="am-u-sm-4"></div>
    </div>
    <div class="am-modal-actions" id="my-actions">
      <div class="am-modal-actions-group">
        <img src="{:ADDON_PUBLIC_PATH}/images/guide.png" />
        <ul class="am-list">
          <li class="am-modal-actions-header">分享</li>
          <li><a href="{:U('set_sn_code',array('id'=>$data[id]))}"><span class="am-icon-gift"></span> 领取红包</a></li>

        </ul>
      </div>
      <div class="am-modal-actions-group">
        <button class="am-btn am-btn-secondary am-btn-block" data-am-modal-close>取消</button>
      </div>
    </div>

  </block><!--body end-->
<block name="script">
  <script src="http://res.wx.qq.com/open/js/jweixin-1.0.0.js"></script>
  <script>
    wx.config({
      debug: true,
      appId: '{$signPackage['appId']}',
      timestamp: {$signPackage['timestamp']},
      nonceStr: '{$signPackage['nonceStr']}',
      signature: '{$signPackage['signature']}',
      jsApiList: [
        // 所有要调用的 API 都要加到这个列表中
        'onMenuShareTimeline',
        'onMenuShareAppMessage',
        'onMenuShareQQ',
        'onMenuShareWeibo'
      ]
    });
    wx.ready(function () {
      // 在这里调用 API

    //朋友圈
    wx.onMenuShareTimeline({
      title: 'UCToo微信JS-SDK Demo',
      desc: 'UCToo微信JS-SDK,帮助第三方为用户提供更优质的移动web服务',
      link: 'http://dev.uctoo.com/index.php?s=/addon/Jssdk/Jssdk/index.html',
      imgUrl: 'http://mmbiz.qpic.cn/mmbiz/icTdbqWNOwNRt8Qia4lv7k3M9J1SKqKCImxJCt7j9rHYicKDI45jRPBxdzdyREWnk0ia0N5TMnMfth7SdxtzMvVgXg/0'
      trigger: function (res) {
        alert('用户点击并朋友圈');
      },
      success: function () {
        // 用户确认分享后执行的回调函数
        alert('Timeline分享成功');
      },
      cancel: function () {
        // 用户取消分享后执行的回调函数
        alert('您取消了分享Timeline');
      }
    });
    wx.onMenuShareAppMessage({
      title: 'UCToo微信JS-SDK Demo',
      desc: 'UCToo微信JS-SDK,帮助第三方为用户提供更优质的移动web服务',
      link: 'http://dev.uctoo.com/index.php?s=/addon/Jssdk/Jssdk/index.html',
      imgUrl: 'http://mmbiz.qpic.cn/mmbiz/icTdbqWNOwNRt8Qia4lv7k3M9J1SKqKCImxJCt7j9rHYicKDI45jRPBxdzdyREWnk0ia0N5TMnMfth7SdxtzMvVgXg/0'
      type: '', // 分享类型,music、video或link，不填默认为link
      dataUrl: '', // 如果type是music或video，则要提供数据链接，默认为空
      success: function () {
        alert('分享给朋友分享成功');
      },
      cancel: function () {
        alert('您取消了分享给朋友');
      }
    });

    });
    wx.error(function (res) {
      alert(res.errMsg);
    });
  </script>
</block>
